import { Form, Icon, Input, Button, Checkbox } from 'antd';
import React from "react";
import  "./NormalLoginForm.css";
import {withRouter} from "react-router-dom";
import browserHistory from 'react-router-dom';
import {Link} from "react-router-dom";
import List from "./List";
const FormItem = Form.Item;
 class NormalLoginForm extends React.Component {
    handleSubmit = (e) => {
        e.preventDefault();
        this.props.form.validateFields((err, values) => {
            if (!err) {
                console.log('Received values of form: ', values);
            }
        });
    }
    render() {
        const { getFieldDecorator } = this.props.form;
        return (
            <Form onSubmit={this.handleSubmit} className="login-form" style={{marginTop:"30px"}}>
                <FormItem>
                    {getFieldDecorator('userName', {
                        rules: [{ required: true, message: 'Please input your username!' }],
                    })(
                        <Input prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder="用户名" />
                    )}
                </FormItem>
                <FormItem>
                    {getFieldDecorator('password', {
                        rules: [{ required: true, message: 'Please input your Password!' }],
                    })(
                        <Input prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} type="password" placeholder="密码" />
                    )}
                </FormItem>
                <FormItem>
                    {getFieldDecorator('remember', {
                        valuePropName: 'checked',
                        initialValue: true,
                    })(
                        <Checkbox style={{float:'left'}}>记住我</Checkbox>
                    )}
                    <a className="login-form-forgot" style={{float:'right'}} href="">忘记密码</a>
                    <Button onClick={()=>{
                        console.log("login")
                        this.props.history.push("/page2");
                    }} type="primary" htmlType="submit"  style={{width:"100%"}}className="login-form-button">
                        登录
                    </Button>
                     <a href="" style={{float:'left'}}>
                         <Link >注册</Link>
                         </a>
                </FormItem>
            </Form>
        );
    }
}
export default withRouter(NormalLoginForm);